/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Pierre
 */


import cannes.bean.planning.*;
import cannes.dao.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

public class main {
    
    public static void main(String[] args){
        DAO<Film> filmDAO = DAOFactory.getFilmDAO();
        Film f = filmDAO.find(1);
        System.out.println(f.getTitre());
        
        DAO<Jure> jureDAO = DAOFactory.getJureDAO();
        Jure j = jureDAO.find(11);
        System.out.println(j.getNom());
        
        ArrayList<Jure> lj = new ArrayList<Jure>();
        
        lj = jureDAO.findAll();
        for (Jure jure : lj) {
            System.out.println(jure.getNom());
        }
        
        
        DAO<Jury> juryDAO = DAOFactory.getJuryDAO();
        Jury jy = juryDAO.find(1);
        System.out.println(((Jure) jy.getListeJure().toArray()[1]).getNom());
        
        ArrayList<Jury> ljy = new ArrayList<Jury>();
        
        ljy = juryDAO.findAll();
        for (Jury jury : ljy) {
            System.out.println(jury.getId());
        }
        
        DAO<Personne> personneDAO = DAOFactory.getPersonneDAO();
        
        ArrayList<Personne> lp = new ArrayList<Personne>();
        
        //Personne p =personneDAO.find(1);
        
        lp = personneDAO.findAll();
        
        for (Personne personne : lp) {
            System.out.println(personne.getPrenom());
        }
        DAO<Projection> projectionDAO = DAOFactory.getProjectionDAO();
        
        Projection proj = projectionDAO.find(1);
        System.out.println(proj.getHorraire());
        
        DAO<Planning> planningDAO = DAOFactory.getPlanningDAO();
        
        ArrayList<Planning> lpl = planningDAO.findAll();
        
        for (Planning planning : lpl) {
            System.out.println(planning.getTypeSelection());
            
        }
        
        DAO<Salle> salleDAO = DAOFactory.getSalleDAO();
        
        ArrayList<Salle> ls = salleDAO.findAll();
        
        for (Salle salle : ls) {
            System.out.println(salle.getNom());
            
        }
        SimpleDateFormat sdf = new SimpleDateFormat("hh:mm dd/MM/yyyy");
        Date d = null;
        try {
            d = sdf.parse("15:10 20/05/2011");
        } catch (ParseException ex) {
            Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
        }
//        Projection p = new Projection(2, d, 2, 1, 1);
//        DAO<Projection> projDAO = DAOFactory.getProjectionDAO();
//        projDAO.create(p);
    }
    
}
